/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package WS;
import BD.Modulos.BdStaff;
import Interfaces.BdException;
import Objects.Log_Personal;
import Objects.Log_TPersonal;
import java.sql.SQLException;
import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.WebServiceContext;
/**
 *
 * @author armgarces
 */
@WebService(serviceName = "Staff")
public class Staff {
    public final static int FIND_PERSONAL   = 0;   
    public final static int FIND_PERSONAL_TP= 1;
    public final static int FIND_TPERSONAL  = 2;
    public final static int CHECK_PERSONAL  = 3;
    public final static int CHECK_TPERSONAL = 4;
    @Resource
    WebServiceContext wsContext;
    /***************************************************************************/
    /****************************** LOG_PERSONAL *******************************/
    /***************************************************************************/
    /**
     * 
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "loadPersonal")
    public synchronized Log_Personal[] loadPersonal() throws BdException {
        try{
            return (Log_Personal[]) BdStaff.getInstance().load(new Log_Personal());
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /**
     * 
     * @param user
     * @param log_personal
     * @param operacion
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "savePersonal")
    public synchronized boolean savePersonal(@WebParam(name = "user") String user,
                                             @WebParam(name = "tpersonal") Log_Personal log_personal,
                                             @WebParam(name = "operacion") int operacion) throws BdException {
//        boolean boo = Validar.validar_Save_log_Personal(log_personal);
//        if (boo){
        try{                
            return BdStaff.getInstance().savePersonal(user,operacion,log_personal);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }
    /**
     * 
     * @param name
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "checkPersonal")
    public synchronized boolean checkPersonal(@WebParam(name = "name") String name) throws BdException {
        try{
            return BdStaff.getInstance().check(CHECK_PERSONAL,name);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }
    /**
     * 
     * @param user
     * @param log_personal
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "changePersonal")
    public synchronized boolean changePersonal(@WebParam(name = "user") String user,
                                               @WebParam(name = "tpersonal") Log_Personal log_personal) throws BdException {
        try{
            return BdStaff.getInstance().change(user,log_personal);                
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }    
    /**
     * 
     * @param find
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "findPersonal")
    public synchronized Log_Personal[] findPersonal(@WebParam(name = "find") String find) throws BdException {
        try{
            return (Log_Personal[]) BdStaff.getInstance().find(new Log_Personal(),find,FIND_PERSONAL,0,0);      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /**
     * 
     * @param find
     * @param tpersonal1
     * @param tpersonal2
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "findPersonal_Tp")
    public synchronized Log_Personal[] findPersonal_Tp(@WebParam(name = "find") String find,
                                                       @WebParam(name = "tpersonal1") int tpersonal1,
                                                       @WebParam(name = "tpersonal2") int tpersonal2) throws BdException {
        try{
            return (Log_Personal[]) BdStaff.getInstance().find(new Log_Personal(),find,FIND_PERSONAL_TP, tpersonal1, tpersonal2);      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /**
     * 
     * @param param1
     * @param param2
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "printPersonal")
    public synchronized Log_Personal[] printPersonal(@WebParam(name = "param1") String param1,
                                                     @WebParam(name = "param2") String param2) throws BdException {
        try{
            return (Log_Personal[]) BdStaff.getInstance().printPersonal(new Log_Personal(),param1, param2);                  
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
  
    /***************************************************************************/
    /**************************** LOG_TPERSONAL ********************************/
    /***************************************************************************/
    /**
     * 
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "loadTPersonal")
    public synchronized Log_TPersonal[] loadTPersonal() throws BdException {
        try{
            return (Log_TPersonal[]) BdStaff.getInstance().load(new Log_TPersonal());      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /**
     * 
     * @param find
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "findTPersonal")
    public synchronized Log_TPersonal[] findTPersonal(@WebParam(name = "find")String find) throws BdException {
        try{
            return (Log_TPersonal[]) BdStaff.getInstance().find(new Log_TPersonal(),find,FIND_TPERSONAL,0,0);      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /**
     * 
     * @param user
     * @param tpersonal
     * @param operacion
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "saveTPersonal")
    public synchronized boolean save_log_TPersonal(@WebParam(name = "user") String user,
                                                   @WebParam(name = "tpersonal") Log_TPersonal tpersonal,
                                                   @WebParam(name = "operacion") int operacion) throws BdException {
//        boolean boo = Validar.validar_Save_log_TPersonal(log_tpersonal);
//        if (boo){
        try{                
            return BdStaff.getInstance().saveTPersonal(user, operacion, tpersonal);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }
    /**
     * 
     * @param name
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "checkTPersonal")
    public synchronized boolean checkTPersonal(@WebParam(name = "name") String name) throws BdException {
        try{
            return BdStaff.getInstance().check(CHECK_TPERSONAL,name);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }
    /**
     * 
     * @param user
     * @param tpersonal
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "changeTPersonal")
    public synchronized boolean changeTPersonal(@WebParam(name = "user") String user,
                                                @WebParam(name = "tpersonal") Log_TPersonal tpersonal) throws BdException {
        try{
            return BdStaff.getInstance().change(user, tpersonal);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }    
    

    
    
}
